package com.lczyfz.campusinfo.modules.alipay.config;

import com.google.common.collect.Maps;
import com.lczyfz.campusinfo.common.utils.PropertiesLoader;
import com.lczyfz.campusinfo.common.utils.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 *创建人:CY
 *创建时间:2017年8月15日 下午5:06:13
 *备注:
 */
@Component 
public class AlipayOldWebConfig {
	/**
	 * 保存全局属性值
	 */
	private static Map<String, String> map = Maps.newHashMap();
	
	/**
	 * 属性文件加载对象
	 */
    private static PropertiesLoader loader = new PropertiesLoader("alipay.properties");
    
	public static String getConfig(String key) {
		String value = map.get(key);
		if (value == null){
			value = loader.getProperty(key);
			map.put(key, value != null ? value : StringUtils.EMPTY);
		}
		return value;
	}
	// 合作身份者ID
	public static String getPartner(){
    	return getConfig("WEB.PARTNER");
    }
	
	public static String getSellerId(){
		return getConfig("WEB.SELLER_ID");
	}
	public static String getPrivateKey(){
		return getConfig("WEB.PRIVATE_KEY");
	}
	public static String getAlipayPublicKey(){
		return getConfig("WEB.ALIPAY_PUBLIC_KEY");
	}
	public static String getNotifyUrl(){
		return getConfig("WEB.NOTIFY_URL");
	}
	public static String getReturnUrl(){
		return getConfig("WEB.RETURN_URL");
	}
	public static String getSignType(){
		return getConfig("WEB.SIGN_TYPE");
	}
	public static String getInputCharset(){
		return getConfig("WEB.INPUT_CHARSET");
	}
	public static String getPaymentType(){
		return getConfig("WEB.PAYMENT_TYPE");
	}
	public static String getService(){
		return getConfig("WEB.SERVICE");
	}
	public static String getUrl(){
		return getConfig("WEB.URL");
	}
	public static String getAntiPhishingKey(){
		return getConfig("WEB.ANTI_PHISHING_KEY");
	}
	public static String getExterInvokeIp(){
		return getConfig("WEB.EXTER_INVOKE_IP");
	}

	// 调试用，创建TXT日志文件夹路径，见AlipayCore.java类中的logResult(String sWord)打印方法。
	public static String log_path = "/home/cardkeyshop/alipay";
	// 合作身份者ID，签约账号，以2088开头由16位纯数字组成的字符串，查看地址：https://b.alipay.com/order/pidAndKey.htm
	/*public static String partner = "2088021079285831";

	// 收款支付宝账号，以2088开头由16位纯数字组成的字符串，一般情况下收款账号就是签约账号
	public static String seller_id = partner;

	//商户的私钥,需要PKCS8格式，RSA公私钥生成：https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.nBDxfy&treeId=58&articleId=103242&docType=1

	public static String private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCB9gqlxMNojfnM6cxKeEw0bdN0ACDJHVpAMqEXeQ1rVN2Cf60q4BsHcSEq/aN4Pl6FAK2Wv4fSc0WemcHBKCxoh/HwqFlY/7RnXl/aELZWTETcyrfurjKHJNUgwyyrGTlxGsMUOd4pdOTPdF731ZcPsU5ru/0wDHzc/4mu5HWAEoavCQ8br4wJO/qRQFHJUW2zCtaNX+9t/2SS1AM6pgQdrWxftZ14TwwwuzAyBMLKZENLQd1DxVZ39J18F11KuOhlF2mCbQsUmiFAqbtCBf9wtwl5Zp3S5TkMeEaqycwkVyt4zDbKBAn6uWMmhZCOnn//8Nx/FuGO8gho2msoV0h5AgMBAAECggEAZuSUs3/gMjRN9SWZ38/0jYHyayH60x/RJ4iuL/ZgYHz1T2+ke5Co9bBk0TO1K+s9TFIoHXUQpNcs5I/ZbgNPfYc8TwwKiUMR4tE+VFjs89A4qRI6o9b5HDRWJTVBdUloSBsnHilesjXhPjplQhSyH/OCIhvZLiSE6zfKG1S3jqh0WYzIf3D2Mkjbu6XG145OEtaEX1YdRY1afKmfN9VjUoLhOGiyt+IW3uvEAAi8H8Y3fBelwb5uQsezr+88BFdWMt178eWceZm+yIEnNle0PlENiOVN1sYUoklQG3gCDoo8ln5g0iH5no7w3eHRZhKNivL7ikEN0tadOGrCHGDvcQKBgQDjmBgYVumSDP93PkSV2PCU34yxoLpVgXwj57sPjjX4mLD4FDKvTnC6YPioEyavrUZ+0wIZ0O9l3gF2eWLo+5GDp5xxmrz4nelS9tVAUtphdCXfHsmkcI0A7UvKK99r2WvaerJxu/wd7CCE+bsJSz3GEPQyPmjYwJmOqFHnsPnHZQKBgQCSLnSA8sxpdpgktg0uvKlYlg3eo2MvNRxHc8Y1LCVkE6QYoOVrDgrybmr3kPK0/7+mJ6opXTcB42tQD8KXBAAh80j0lSwU0OYtgSmxeFNRB3MVthEd+Qr+T4Z3jFmFrGAFEpdE6+osKga7SfieWBNKz+L7cm8q5Okf2ScsCeddhQKBgGLCHsKBBD1h8oC1vmEfj9Wp4404Z2KvG0UhSuSHGxhSeYhMi2nSqcvWRE/6b3EPyWVC/shhB2C2ov/b0HW0pAHy+0m4kYN4UkSz4vlUenqLQdu9qlX2mNjsH1UNEJfl8o0NbN05az84tSu+idCQm6+Ur8IVnr1fZcKne1MEUn6ZAoGAGIAAtrv61pIx3bVFcFfeaiJ8IJxxuy/DlZYp2i+T9Ln1/sq4qMCpxQgMlYGNrBhRHp/3PQeKeJ6NFdYOXxEklIwZ5iQ6RyLb8TR8sGniTOpat4DUTZm35feeKds0BdtmHHOJNtvzW4OPrUQwjxlj4l4FRO9hAmdrSxMyJYdjZ6ECgYEAmnsusqJBRlQHQ8VX2/01/xzcoXJDUlKLy9p6Y80dQCaETSnqOgG6SJnJuvI7shk7+/b64DVQX38v9VsuVsc/SKND/96m1TM096hzulhWJRmmkldYUpGyA5QEhXfgrvwlb7ZNUCTqwzjxkcxRfRWAbwSlujdGM16GWFLEfZ0jPz0=";


	// 支付宝的公钥,查看地址：https://b.alipay.com/order/pidAndKey.htm
	public static String alipay_public_key  = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "https://card.fjut.edu.cn/oldAlipayWeb/notify_url";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "https://card.fjut.edu.cn/oldAlipayWeb/return_url";

	// 签名方式
	public static String sign_type = "RSA";

	// 调试用，创建TXT日志文件夹路径，见AlipayCore.java类中的logResult(String sWord)打印方法。
	public static String log_path = "C:\\";

	// 字符编码格式 目前支持 gbk 或 utf-8
	public static String input_charset = "utf-8";

	// 支付类型 ，无需修改
	public static String payment_type = "1";

	// 调用的接口名，无需修改
	public static String service = "create_direct_pay_by_user";
//	public static String service = "alipay.wap.create.direct.pay.by.user";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

//↓↓↓↓↓↓↓↓↓↓ 请在这里配置防钓鱼信息，如果没开通防钓鱼功能，为空即可 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 防钓鱼时间戳  若要使用请调用类文件submit中的query_timestamp函数
	public static String anti_phishing_key = "";

	// 客户端的IP地址 非局域网的外网IP地址，如：221.0.0.1
	public static String exter_invoke_ip = "";

	//↑↑↑↑↑↑↑↑↑↑请在这里配置防钓鱼信息，如果没开通防钓鱼功能，为空即可 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
	public static String URL ="https://mapi.alipay.com/gateway.do";*/

}
